/// @file unrootedtree-builder.cc
/// @brief Methods associated with the unrooted tree structures

// *************************************************************************

// Copyright© 2010 Texas A&M University, 
//                 College Station, Texas
//                 Contact: R Crosby <rwc@cs.tamu.edu>
//
// Copyright© 2003, 2004 by BiRC -- Bioinformatics Research Center
//                 University of Aarhus, Denmark
//                 Contact: Thomas Mailund <mailund@birc.dk>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// *************************************************************************

#ifndef UNROOTEDTREEBUILDER_HH
#define UNROOTEDTREEBUILDER_HH

#include "unrootedtree.hh"

#include <list>
#include <stack>

using namespace std;

class SMap;

class UnrootedTreeBuilder {
private:
    stack<UnrootedTreeNode *> _stack;
    list<UnrootedTreeNode *>  _completed;
    
    SMap & smap;

    bool build_completed() const { return _stack.size() == 0; }

    //UnrootedTreeNode *create_inner();
    //UnrootedTreeNode *create_leaf(const char *s);

public:
    UnrootedTreeBuilder(SMap & s) : smap(s) {}
    virtual ~UnrootedTreeBuilder() {}

    void push_internal();
    void pop_internal();
    void add_leaf(const char *s);
    
    UnrootedTree *build_tree();
};

#endif // UNROOTEDTREEBUILDER_HH
